package servlet;

import hbase.UserLogFromHBase;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

@WebServlet("/studentQuery")
public class HbaseQuery extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        // 获取查询参数
        String id  = req.getParameter("StudentId");
        String name  = req.getParameter("name");


        // 获取
        UserLogFromHBase userLogFromHBase = new UserLogFromHBase();
        String [] stringObject = new String[1];
         stringObject[0] = "info";
        List<String> stringList = userLogFromHBase.getUserLogList("Student",stringObject);


        resp.setContentType("text/html;charset=utf-8");
//        PrintWriter pw =  resp.getWriter();
//        pw.write("<h1>"+  stringList.forEac;);

        req.setAttribute("objResult",stringList);
        req.getRequestDispatcher("/managerResult.jsp").forward(req,resp);



    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
